// 延迟执行
// 在做
function currying(func) {
    const args = []
    return function result(...rest) {
        if(rest.length == 0) {
            return func(...args)
        }
        args.push(...rest)
        return result;
    }
};
// 要curry 干嘛？ 没有柯里化
// reduce map filter es6 函数式编程实践
const add = (...args) => args.reduce((a,b) => a + b)
const sum = currying(add)
console.log(sum(1)(2)(3)(4))